package com.liwei.appdata;

import com.liwei.beans.Stu;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class MyApp2 {
    public static void main(String[] args) {
        String path = "D:\\aa.data";
        Stu stu;
        try {
            FileInputStream fileInputStream = new FileInputStream(path);
            ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
            //反序列号
            Stu o = (Stu) objectInputStream.readObject();
            objectInputStream.close();
            fileInputStream.close();
            System.out.println(o);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

    }
}
